//商品管理模块的接口
import request from '@/utils/request'
import type {
  OrderRecords,
  Status,
//枚举地址
} from './type'
import { RoleResponseData } from '@/api/acl/role/type'

enum API {
  //获取所有订单
  ALLORDER_URL = '/order/getSeckillOrderAll',
  //添加一个新订单
  ADDORDER_URL = '/order/saveSeckillOrder',
  //获取用户维度 订单
  GETSECKILLORDERBYUSERID_URL = '/order/getSeckillOrderByUserId',
  //获取活动维度 订单
  GETSECKILLORDERBYACTIVITYID_URL = '/order/getSeckillOrderByActivityId',
  //删除商品
  DELORDER_URL = '/order/delOrderById',
}

//获取所有订单
export const reqOrderInfoAll = () => {
  return request.post<any, any>(API.ALLORDER_URL)
}
// 增加商品
export const reqAddOrder = (data: OrderRecords) => {
  return request.post<any, any>(API.ADDORDER_URL, data)
}
//根据用户id 获取订单
export const reqGetSeckillOrderByUserId = (userId: number) =>
  request.get<any, any>(
    API.GETSECKILLORDERBYUSERID_URL + `/?userId=${userId}`,
  )
//根据活动id 获取订单
export const reqGetSeckillOrderByActivityId = (activityId: number) =>
  request.get<any, any>(
    API.GETSECKILLORDERBYACTIVITYID_URL + `/?activityId=${activityId}`,
  )
//删除订单
export const reqDelOrder = (id: number) =>
  request.get<any, any>(
    API.DELORDER_URL + `/?id=${id}`,
  )
